﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Yu.Cms.Common;
namespace Yu.Cms.Web.UserCtrl.Default
{
    public partial class AlbumListC : BaseCtrl
    {
        public string PrePhoto = string.Empty;
        
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.OnStart();
            }
        }

        protected void OnStart()
        {
            //PrePhoto = YuRequest.GetQueryString("Photo");
            int alBigID = YuRequest.GetQueryInt("PostID");
            this.UpdateClickAlbum(alBigID);
            this.ShowInfo(alBigID);
            this.BindrptListView(alBigID);
        }

      

        /// <summary>
        /// 增加点击次数
        /// </summary>
        /// <param name="alBigID"></param>
        protected void UpdateClickAlbum(int alBigID)
        {
            bllalbumType.UpdateAlbumClick(alBigID);
        }

        /// <summary>
        /// 初始化显示信息
        /// </summary>
        /// <param name="alBigID"></param>
        protected void ShowInfo(int alBigID)
        {
            int aClick;
            int aComment;
            DateTime pubTime;
            string title;
            Yu.Cms.Model.albumType fam = bllalbumType.GetModel(alBigID);
            title = lblBigTypeName1.Text = lblBigTypeName2.Text = fam.alBigName;
            pubTime = fam.pubTime;
            aClick = fam.alClick;
            aComment = fam.alComment;
            lblPubTime.Text = GetDateAndTime(pubTime);
            lblClick.Text = Utils.IntToStr(aClick);
            lblComment.Text = Utils.IntToStr(aComment);

            (base.Page.Master.FindControl("lblTitle") as Literal).Text = title;
        }

        /// <summary>
        /// 绑定
        /// </summary>
        protected void BindrptListView(int aBigID)
        {
            int PageIndex = 1;
            int PageSize = int.MaxValue;
            int RecordCount = 0;
            rptPList.DataSource = bllalbum.GetList(aBigID, PageIndex, PageSize, out RecordCount);
            rptPList.DataBind();
        }
    }
}